#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
class Solution {
public:
    bool Find(int target, vector<vector<int> > array)
    {
        int n = array.size();
        if (n == 0)
            return false;
        int l = array[0].size();
        int left = 0, down = n - 1;
        while (left < l && down >= 0)
        {
            if (target == array[down][left])
            {
                return true;
            }
            else if (target > array[down][left])
            {
                left++;
            }
            else
            {
                down--;
            }
        }

        return false;

    }
};



